<?php
include('../global.php');
if(isset($_GET['name']))
{
	//print_r($_GET);
	$query = sprintf("select * from `%s` where `userid`='%s' and `password`=sha1('%s')", 
					 PREFIX . 'reader', 
					 mysql_real_escape_string($_GET['name']), 
					 mysql_real_escape_string($_GET['pass']));
	if($res = $mysql->_select($query))
	{
		$_SESSION['reader'] = $_GET['name'];	//登录成功
		$_SESSION['readerid'] = $res['id'];
		echo '你好： <font color="#0000FF">' . $_SESSION['reader'] . ' </font>，欢迎登录';
		echo ' <a href="book_borrow_back.php" target="_self">我的收藏 </a>|';
		echo ' <a href="book_borrow_back.php" target="_self">控制面板 </a> |&nbsp;';
		echo '<a href="index.php?action=logout" name="logout">退出系统</a>';
	}
	else
	{
		echo '0';
	}
}
?>